<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>定时任务修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all" />
    <link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_1041315_0zq2yro0cfn.css">
    <style type="text/css">
        .layui-form-item .layui-inline{ width:33.333%; float:left; margin-right:0; }
        @media(max-width:1240px){
            .layui-form-item .layui-inline{ width:100%; float:none; }
        }
        .layui-form-item .role-box {
            position: relative;
        }
        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }

    </style>
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
    <div class="layui-form-item">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
            <legend style="font-size:16px;">任务信息</legend>
        </fieldset>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">任务名称</label>
        <div class="layui-input-block">
            <input type="hidden" id="id" name="id" th:value="${scheduleJob.id}">
            <input type="text" class="layui-input" name="jobName" th:value="${scheduleJob.jobName}" lay-verify="required" placeholder="请输入名称">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">表达式</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="cronExpression" th:value="${scheduleJob.cronExpression}" lay-verify="required" placeholder="表达式">
            <div id="ms" class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span><a href="http://cron.qqe2.com/" target="_blank">获取表达式</a>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">执行类</label>
        <div class="layui-input-block">

            <input type="text" class="layui-input" name="methodName"th:value="${scheduleJob.methodName}"  lay-verify="required" placeholder="执行类">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <textarea name="desc" class="layui-textarea" placeholder="描述" th:text="${scheduleJob.desc}"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="edit">修改</button>
            <button type="reset" class="layui-btn layui-btn-primary" id="close">取消</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="/layui/layui.js"></script>
<script>
    layui.config({
        base: '/js/common/' //假设这是你存放拓展模块的根目录
    }).use(['form','jquery','layer','common'],function(){
       var form = layui.form,
           $    = layui.jquery,
           common = layui.common,
        layer = layui.layer;

        form.on("submit(edit)",function(data){
            $("#HandoverCompany").val(data.value);
            var saveLoading = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            $.post("add",data.field,function(res){
                if(res.success){
                    top.layer.close(saveLoading);
                    common.cmsLaySucMsg("修改成功！");
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭                        //刷新父页面
                    parent.location.reload();
                }else{
                    top.layer.close(saveLoading);
                    common.cmsLayErrorMsg("修改失败");
                }
            });
            return false;
        });
        $("#close").on("click", function(){
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭
        } )
    });
</script>
</body>
</html>